﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : MultiServerEngine | ServerFramework | PeerConfig.cs
// //  Created : 2016 - 02 - 16 20:53
// //  Modified: 2016 - 02 - 20 12:32
// //  ********************************************************************************

using System.Collections.Generic;
using System.Linq;
using ServerFramework.Interfaces.Configuration;

namespace ServerFramework.Implementation.Configuration
{
    public class PeerConfig : IPeerConfig
    {
        private readonly IList<object> _config = new List<object>();

        public void AddPeerConfig(object conf)
        {
            if (_config.Contains(conf)) return;
            _config.Add(conf);
        }

        public T GetPeerConfig<T>() where T : class
        {
            object config = _config.FirstOrDefault(c => c is T);

            return config as T;
        }
    }
}
